package com.chixing.work_04;

public class AccountTest {
    public static void main(String[] args) {
        SavingAccount sa1 = new SavingAccount(1,"A","A123",18715322542L,1000);
        System.out.println(sa1.toString());
        sa1.depoist(100);
        sa1.withdraw(200);
        System.out.println(sa1.toString());

        CreditAccount cr1 = new CreditAccount(2,"B","1123",17849037855L,1000);
        cr1.withdraw(1900);
        System.out.println("当前余额:" + cr1.getAccBalance());
        System.out.println("透支额度:" + cr1.getAlreadyOverdraw());


        Bank bank = new Bank();
        bank.registAccount(cr1);
        bank.registAccount(sa1);
        for (int i = 0;i < bank.getAccountArr().length;i++ ){
            if (bank.getAccountArr()[i] == null)
                continue;
            System.out.println(bank.getAccountArr()[i]);
        }






//        Bank bank1 = new Bank();
//        for (int i = 0;i<20;i++){
//            long accno = (int)(622262*1000);
//            accno += (int)((Math.random()*9+1)*100);
//            if (i<20*0.7)
//            bank1.registAccount(new CreditAccount(accno,"","",11L,0));
//            else
//            bank1.registAccount(new SavingAccount(accno,"","",11L,0));
//        }
//        for (int i = 0;i < bank1.getAccountArr().length;i++ ){
//            if (bank1.getAccountArr()[i] == null)
//                continue;
//            System.out.println(bank1.getAccountArr()[i]);
//        }

    }
}
